<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
   <title>佐心，教家长做父母</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">

    <link rel="stylesheet" href="assets/css/amazeui.min.css">
    <link rel="stylesheet" href="assets/css/style.css?v=2.3">
    <link rel="stylesheet" href="assets/css/index.css?v=2.3">
        <script src="assets/js/myAlert.js"></script>
    <script>
    	    /** 
     * 返回前一页（或关闭本页面） 
     * <li>如果没有前一页历史，则直接关闭当前页面</li> 
     */  
    function goBack(){  
        if ((navigator.userAgent.indexOf('MSIE') >= 0) && (navigator.userAgent.indexOf('Opera') < 0)){ // IE  
            if(history.length > 0){  
                window.history.go( -1 );  
            }else{  
                location.href="${ctx}/index.jsp";
            }  
        }else{ //非IE浏览器  
            if (navigator.userAgent.indexOf('Firefox') >= 0 ||  
                navigator.userAgent.indexOf('Opera') >= 0 ||  
                navigator.userAgent.indexOf('Safari') >= 0 ||  
                navigator.userAgent.indexOf('Chrome') >= 0 ||  
                navigator.userAgent.indexOf('WebKit') >= 0){  
      
                if(window.history.length > 1){  
                    window.history.go( -1 );  
                }else{  
                    location.href="${ctx}/index.jsp";
                }  
            }else{ //未知的浏览器  
                window.history.go( -1 );  
            }  
        }  
    }  
    </script>
</head>
<body class="bg-white">
<header data-am-widget="header" class="am-header am-header-default am-header-fixed am-border-bottom">
    <div class="am-header-left am-header-nav">
        <a  onclick="goBack();"  >
            <i class="icon_8"></i>
        </a>
    </div>
    <h1 class="am-header-title">
        确认付款
    </h1>

</header>
<section class="am-padding-bottom-sm" id="amz-main" data-tag="css-nav">
    <div class=" am-padding-bottom-sm">
        <div class="report_item bg-gray am-margin-left-sm am-margin-right-sm am-margin-top-sm">
            <div class="am-g   am-padding-top-sm   am-padding-bottom-sm">
                <div class=" am-u-sm-12 am-list-main font-color-13 box">
                    <i class="icon_12"></i>

                    <div class="width-50px">
                        <div class="icon_9-1"></div>
                        <div class="line-1">
                            <i class="circle-1"></i>
                        </div>
                        <div class="line-3">
                            <i class="circle-1"></i>
                        </div>
                        <div class="line-3">
                            <i class="circle-1"></i>
                        </div>
                        <div class="line-3">
                            <i class="circle-1"></i>
                        </div>
                    </div>
                    <div class="box-1">
                        <div class="am-list-item-hd font-color-13 am-padding-top-sm am-text-truncate">
                            培训购买：${study.studyTitle}
                        </div>
                        <div class="font-14  margin-top-10 min-height-44" >
                            集训时间：${study.startStudyStr} 至 ${study.endStudyStr}
                        </div>
                        <div class="font-14   min-height-44">
                            标准价格：<span class="font-color-17">&yen;${study.studyPrice}</span>
                        </div>
                        <div class="font-14 margin-top-2px  min-height-44">
                            购买者：${order.customerName}
                        </div>
                        <div class="font-14 margin-top-2px">
                            联系方式：${order.telephone}
                        </div>

                    </div>
                </div>


            </div>
        </div>
    </div>

    <div class="am-padding-left-lg am-padding-right-sm">
        <div class="box font-color-13 am-margin-bottom-sm am-margin-top-xs">
            <div class="width-40px">
                <div class="icon_10"></div>
            </div>
            <div class="box-1 padding-top-3px" >
                付款方式：微信支付
            </div>
        </div>
        <div class="box font-color-13 am-margin-bottom-sm">
            <div class="width-40px">
                <div class="icon_68"></div>
            </div>
            <div class="box-1 padding-top-3px">
                下单时间：${order.dateAddStr}
            </div>
        </div>
        <div class="box font-color-13 am-margin-bottom-sm">
            <div class="width-40px"><div class="icon_69"></div></div>
            <div class="box-1 padding-top-3px">
                订单编号：${order.orderSn}
            </div>
        </div>
        <div class="box font-color-17">
            <div class="width-40px"><div class="icon_70"></div></div>
            <div class="box-1 padding-top-3px ">
                总价：&yen;${order.orderPrice}
            </div>
        </div>
    </div>

    <div class="am-padding-sm">
        <div class="btn-4 word-space-2 padding-left-0" id="choose">立即支付</div>
    </div>

</section>

<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/amazeui.min.js"></script>
<script>
 	$(document).ready( function(){
		$("#choose").click(function(){
		//点击测试,注意参数是demo中生成的package
		var appId='${appId}';
		var timeStamp='${timeStamp}';
		var nonceStr='${nonceStr}';
		var package1='${package1}';
		var signType='${signType}';
		var paySign='${paySign}';
	    WeixinJSBridge.invoke('getBrandWCPayRequest',{"appId":appId,"timeStamp":timeStamp,"nonceStr":nonceStr,"package":package1,"signType" :signType,"paySign":paySign},
	    function(res){
	       //支付成功或失败前台判断
   	       if(res.err_msg=='get_brand_wcpay_request:ok'){
   	    	   myAlert('恭喜您，支付成功!');
   	    	   location.href="paySuccess.jsp";
   	       }else{
   	    	   myAlert('支付失败');
   	    	    location.href="payFailure.jsp";
   	       }
	     });
	     });
  });
 </script>
</body>
</html>